{include file="public/head"}

<body>
<div id="wrapper">
    {include file="public/menu"}

    <div id="page-wrapper" class="gray-bg dashbard-1">
        {include file="public/nav"}
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>等级申请</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="{:url('Index/index')}">主页</a>
                    </li>
                    <li>
                        <a>会员</a>
                    </li>
                    <li>
                        <strong>等级申请</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">

            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>等级申请</h5>
                            <div class="ibox-tools">
                                <small>共 {$Count} 条</small>
                            </div>
                        </div>

                        <div class="ibox-content">
                            <form method="get" action="{:url('Finance/WithdrawList')}">
                                <div class="row">
                                    <div class="col-sm-4 m-b-xs">
                                        <div class="row">
                                            <div class="col-sm-2 m-b-xs"></div>
                                            <div class="col-sm-3 m-b-xs">处理状态</div>
                                            <div class="col-sm-7 m-b-xs">
                                                <select class="input-sm form-control input-s-sm inline" id="status" name="status">
                                                    <option value="5" {if condition="$Data.status eq 5"}selected{/if}>全部</option>
                                                    <option value="0" {if condition="$Data.status eq 0"}selected{/if}>未处理</option>
                                                    <option value="1" {if condition="$Data.status eq 1"}selected{/if}>已通过</option>
                                                    <option value="2" {if condition="$Data.status eq 2"}selected{/if}>已驳回</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-sm-4 m-b-xs">
                                        <div class="row">
                                            <div class="col-sm-2 m-b-xs"></div>
                                            <div class="col-sm-3 m-b-xs">会员账号</div>
                                            <div class="col-sm-7 m-b-xs">
                                                <input type="text" class="input-sm form-control input-s-sm inline" id="username" name="username" value="{$Data.username|default=''}">
                                            </div>
                                        </div>
                                    </div>

<!--                                    <div class="col-sm-4 m-b-xs">-->
<!--                                        <div class="row">-->
<!--                                            <div class="col-sm-2 m-b-xs"></div>-->
<!--                                            <div class="col-sm-3 m-b-xs">会员名称</div>-->
<!--                                            <div class="col-sm-7 m-b-xs">-->
<!--                                                <input type="text" class="input-sm form-control input-s-sm inline" id="title" name="title" value="{$Data.title|default=''}">-->
<!--                                            </div>-->
<!--                                        </div>-->
<!--                                    </div>-->

                                </div>

                                <div class="row">
                                    <div class="col-sm-4 m-b-xs">
                                        <div class="row">
                                            <div class="col-sm-2 m-b-xs"></div>
                                            <div class="col-sm-3 m-b-xs">开始时间</div>
                                            <div class="col-sm-7 m-b-xs">
                                                <input type="datetime-local" class="input-sm form-control input-s-sm inline" id="begin_time" name="begin_time" value="{$Data.begin_time|default=''}">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-sm-4 m-b-xs">
                                        <div class="row">
                                            <div class="col-sm-2 m-b-xs"></div>
                                            <div class="col-sm-3 m-b-xs">结束时间</div>
                                            <div class="col-sm-7 m-b-xs">
                                                <input type="datetime-local" class="input-sm form-control input-s-sm inline" id="end_time" name="end_time" value="{$Data.end_time|default=''}">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-sm-3 m-b-xs">
                                        <div class="row">
                                            <div class="col-sm-6 m-b-xs"></div>
                                            <div class="col-sm-6 m-b-xs">
                                                <button class="btn btn-sm btn-primary" type="submit" id="search"><i class="fa fa-search"></i> 搜索</button>
                                                <button class="btn btn-sm btn-success" type="submit" id="export">导出Excel</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <div class="table-responsive">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>会员账号</th>
                                        <th>当前等级</th>
                                        <th>理财金额</th>
                                        <th>申请等级</th>
                                        <th>申请时间</th>
                                        <th>备注信息</th>
                                        <th>处理时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {volist name="LevelApplyList" id="v"}
                                    <tr>
                                        <td>{$key+1}</td>
                                        <td>{$v.username}</td>
                                        <td>{$v.now_level}</td>
                                        <td>{$v.deposit}</td>
                                        <td>{$v.level_name}</td>
                                        <td>{$v.add_time|date="Y-m-d H:i:s",###}</td>
                                        <td>{$v.remarks}</td>
                                        <td>
                                            {if condition="$v.sure_time neq ''"}
                                            {$v.sure_time|date="Y-m-d H:i:s",###}
                                            {/if}
                                        </td>

                                        <td>
                                            {if condition="$v.status eq 0"}
<!--                                            <a title="通过" href="javascript:;" onClick="level_sure(this,{$v.id})"><i class="fa fa-check-square-o text-navy"></i></a>-->
                                            <a title="申请记录处理" href="javascript:;" onclick="level_edit('申请记录处理','{:url("Level/LevelApplyEdit",["id"=>$v["id"]])}','800','658')" class="btn btn-xs btn-danger">点击处理</a>
<!--                                            <a title="驳回" href="javascript:;" onClick="level_back(this,{$v.id})"><i class="fa fa-mail-reply-all text-navy"></i></a>-->
                                            {elseif condition="$v.status eq 1"}
<!--                                            <button class="btn btn-xs btn-success">已通过</button>-->
                                            <a title="申请记录详情" href="javascript:;" onclick="level_edit('申请记录详情','{:url("Level/LevelApplyEdit",["id"=>$v["id"]])}','800','604')" class="btn btn-xs btn-success">查看详情</a>

                                            {elseif condition="$v.status eq 2"}
<!--                                            <button class="btn btn-xs btn-danger">已驳回</button>-->
                                            <a title="申请记录详情" href="javascript:;" onclick="level_edit('申请记录详情','{:url("Level/LevelApplyEdit",["id"=>$v["id"]])}','800','604')" class="btn btn-xs btn-success">查看详情</a>

                                            {/if}
                                        </td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </div>
                            <div class="row" style="text-align: center">
                                {$Page}
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        {include file="public/foot"}

    </div>
</div>
</div>
{include file="public/footer"}
<script>
    /*条件搜索*/
    var searchurl = "{:url('Level/LevelApply')}";
    $('#search').click(function () {

        $('form').attr('action',searchurl);
    });

    /*Excel导出*/
    var exporturl = "{:url('Level/LevelApplyExport')}";
    $('#export').click(function () {

        $('form').attr('action',exporturl);
    });

    /*记录-通过*/
    function level_sure(obj,id){
        layer.confirm('确认要通过吗？',function(index){
            $.ajax({
                type:"post",
                url:"{:url('Level/LevelSure')}",
                data:{
                    id:id,
                },
                dataType:"json",
                success:function(data){
                    if(data.status == 1){
                        layer.msg(data.message,{icon: 6,time:1500},function () {
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.message,{icon: 5,time:1500});
                    }
                }
            });
        });
    }

    /*记录-驳回*/
    function level_back(obj,id){
        layer.confirm('确认要驳回吗？',function(index){
            $.ajax({
                type:"post",
                url:"{:url('Level/LevelBack')}",
                data:{
                    id:id,
                },
                dataType:"json",
                success:function(data){
                    if(data.status == 1){
                        layer.msg(data.message,{icon: 6,time:1500},function () {
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.message,{icon: 5,time:1500});
                    }
                }
            });
        });
    }

    /*记录-编辑*/
    function level_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }
</script>
</body>
</html>
